package com.its.common.net.server.channel;

import io.netty.channel.Channel;
import io.netty.channel.ChannelId;
import io.netty.util.AttributeKey;

import java.util.List;
import java.util.Optional;

/**
 * @Author xiaxp
 * @Date 9/1/22 17:15
 * @Description
 */
public interface ChannelManager {

    void addChannel(Channel channel);

    void removeChannel(ChannelId channelId);

    List<Channel> getAllChannels();

    ChannelWrapper getChannelWrapper(ChannelId channelId);

    ChannelWrapper getChannelWrapper(String longId);

    List<ChannelWrapper> getAllChannelWrappers();

    Channel getChannelFromChannelId(ChannelId channelId);

    Channel getChannelFromAddrAndPort(String addr, int port);

    Optional<Channel> filterByAttribute(AttributeKey key, String attr);
}
